package com.weixin.util;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.apache.commons.dbutils.QueryRunner;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * C3p0数据库连接工具类
 * @author 唐鑫明
 */
public class C3p0Util {
	public static final DataSource DATASOURSE = new ComboPooledDataSource();
	public static QueryRunner qr = new QueryRunner(DATASOURSE);

	/**
	 * 获取单独个一个链接
	 * @return
	 */
	public static Connection getConnection() {
		try {
			return DATASOURSE.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
